// 体验详情
define(['backbone', './components/header.scroll', './components/swiper'], function(Backbone, HeaderScroll, Swiper) {

	var EnjoyDetailView = Backbone.View.extend({
		el: '#app',
		initialize: function() {
			this.initHeaderScroll();
			this.initSwiper();
		},
		initHeaderScroll: function() {
			this.HeaderScroll = new HeaderScroll({
				banner: '.com-detail-banner'
			})
		},
		initSwiper: function() {
			// 文章列表swiper
			this.articleSwiper = new Swiper({
				el: this.$('.com-article-swiper'),
				onSlideChangeEnd: _.bind(this.evt_updateArticleSlide, this)
			});
			// 可能感兴趣的体验
			this.intrestedSwiper = new Swiper({
				el: this.$("#j_intrested_swiper"),
				slidesPerView: 'auto'
			});
		},
		evt_updateArticleSlide: function(swiper) {
			var curIdx = swiper.activeIndex;
			var $curSlide = $(swiper.slides[swiper.activeIndex]);
			var tip = $curSlide.data('tip');
			var $curContainer = $(swiper.container[0]);
			var $curTipDom = $curContainer.find('.swiper-tips');
			$curTipDom.text((curIdx + 1) + '/' + swiper.slides.length + '：' + tip);
		}
	});

	return new EnjoyDetailView();
});